package leetcode.weekly.week321;

//Solution1Test
public class Solution1 {

	public int pivotInteger(int n) {
		for (int i = 1; i <= n; i++) {
			int s1 = (1 + i) * i / 2;
			int s2 = (i + n) * (n - i + 1) / 2;
			if (s1 == s2)
				return i;
		}
		return -1;
	}
}
